﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace L4View.BusinessModel
{
    using Infrastructure;

    public abstract class LoggingMonitor : MessageMonitor, ILoggingMonitor
    {
        private readonly FileSeeker _fileSeeker;

        private readonly NotifyMessageCollection _messageCollection;

        protected LoggingMonitor(FileSeeker fileSeeker, MessageParser parser)
            : base(fileSeeker, parser, 100)
        {
            _fileSeeker = fileSeeker;
            _messageCollection = new NotifyMessageCollection();
            
            RegisterSink(_messageCollection);
        }

        public IFileSeeker FileSeeker
        {
            get { return _fileSeeker; }
        }

        public ILogCollection LogCollection
        {
            get { return _messageCollection; }
        }

        public void AssignSourcePath(ISourcePath sourcePath)
        {
            var source = _fileSeeker as ISource;
            
            source.AssignPath(sourcePath);
        }
    }
}
